#!/bin/bash

# pingIpOnline12.sh

forFile7=`cat ./forFile7.sh`

echo -e '-sh脚本for循环命令解说-'"\r\n"$forFile7

echo "\r"
echo "\r\n"
echo "\n"

memo=$(cat ../memo/memo.sh)

echo -e '-sh脚本多行注释-'"\r\n"${memo}

echo "\n"

# 自动扫描1-254网段的所有主机，统计在线主机数与不在线主机数

declare -i online=0
declare -i offline=0
declare -i host=1 
 
for host in `seq 254`;do
 ping -c 1 -W 1 10.1.250.$host &> /dev/null && echo "10.1.250.$host is online" && let online=$online+1 || let offline++
done
echo "Online hosts number : $online"
echo "Offline hosts number : $offline"
